﻿CREATE TABLE [dbo].[tblRMAReturn] (
    [OrderID]              INT           NOT NULL,
    [RMAReturnID]	int IDENTITY (1, 1)  NOT NULL,
    [IssueDate]            SMALLDATETIME NULL,
    [ReceiptDate]          SMALLDATETIME NULL,
    [ImportDate]           SMALLDATETIME NULL,
    [UserID]            int  NULL,
    [ReceiptConfirmedDate] SMALLDATETIME NULL,
    [ReturnTypeID]         INT           NULL,
	[SourceNumber] int null,
	[AutoRefund] bit null default(1),
	[UserDefined1]         NVARCHAR (50)  NULL,
	[UserDefined2]         NVARCHAR (10)  NULL,
	[UserDefined3]         INT            NULL,
	[UserDefined4]         SMALLDATETIME  NULL,
	[UserDefined5]         BIT            NULL
);
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Defines a return.  Gets created when a customer calls up and says they are going to return something.', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The OrderID that the return is tied to.', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'OrderID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Date item was received at warehouse.', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'ReceiptDate';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The RMA created date', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'ImportDate';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Agent who issued the RMA', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'UserID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Date the receipt of the item was confirmed to us.', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'ReceiptConfirmedDate';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The return type ID.  Links to codeReturnType.', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'ReturnTypeID';
GO;
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'If AutoRefund is set to 1 then when the return is received a refund will automatically be generated.  Otherwise a refund will not be automatically generated', 
	@level0type = N'SCHEMA', @level0name = N'dbo', 
	@level1type = N'TABLE', @level1name = N'tblRMAReturn', 

	@level2type = N'COLUMN', @level2name = N'AutoRefund';


